package com.air.config.startegy.config;

import com.air.config.startegy.common.Strategy;
import com.air.config.startegy.handler.DemoStrategyHandler1;
import com.air.config.startegy.handler.DemoStrategyHandler2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * 配置策略
 *
 * @author shent
 */
@Configuration
public class StrategyConfig {
    @Autowired
    DemoStrategyHandler1 serviceImpl1;
    @Autowired
    DemoStrategyHandler2 serviceImpl2;

    @Bean
    public Map<String, Strategy> getMap() {
        Map<String, Strategy> strategyMap = new HashMap<>();
        strategyMap.put("1", serviceImpl1);
        strategyMap.put("2", serviceImpl2);
        return strategyMap;
    }
}
